package STRCON_LOOP;

public class Example {
    public String test1(int n, String x) {
        String res = "";
        for (int i = 0; i < n; i++) {
            res+=x;
        }
        return res;
    }
    // fixed code
    public String test2(int n, String x) {
        StringBuffer res = new StringBuffer();
        for (int i = 0; i < n; i++) {
            res.append(x);
        }
        return res.toString();
    }
}
